﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Ruanmou.Framework.ExpressionE.ExpressionHelper
{
    /// <summary>
    /// 替换参数
    /// </summary>
    internal class NewExpressionVisitor: ExpressionVisitor
    {
        public ParameterExpression _newparameterExpression  { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameterExpression"></param>
        public NewExpressionVisitor(ParameterExpression parameterExpression)
        {
            this._newparameterExpression = parameterExpression;
        }

        public Expression Replace(Expression exp)
        {
            return base.Visit(exp);
        }

        protected override Expression VisitParameter(ParameterExpression node)
        {
            return this._newparameterExpression;
        }


    }
}
